<nz-modal [(nzVisible)]="isVisible" [nzWidth]="modalWidth" (nzOnCancel)="onBack()" [nzStyle]="{'top': '50px'}">
  <div *nzModalTitle>{{ title }}</div>
  <ng-container *nzModalContent>
    <form [formGroup]="contractForm" (keydown.enter)="$event.preventDefault()">
      <nz-row [nzGutter]="10">
        <nz-col [nzSpan]="12">
          <nz-form-item>
            <nz-form-label [nzSpan]="6" nzFor="candidateName" nzRequired>应聘者姓名</nz-form-label>
            <nz-form-control [nzErrorTip]="'请选择应聘者姓名'">
              <nz-input-group nzSearch [nzAddOnAfter]="candidateNameSuffixIconButton">
                <input nz-input formControlName="candidateName" placeholder="请选择应聘者姓名" readonly />
              </nz-input-group>
              <ng-template #candidateNameSuffixIconButton>
                <button nz-button nzType="primary" nzSearch (click)="findCandidate()"><nz-icon nzType="search" /></button>
              </ng-template>
            </nz-form-control>
          </nz-form-item>
        </nz-col>
        <nz-col [nzSpan]="12">
          <nz-form-item>
            <nz-form-label [nzSpan]="6" nzFor="contractSignDate">合同签订日期</nz-form-label>
            <nz-form-control >
              <nz-date-picker formControlName="contractSignDate" nzFormat="yyyy-MM-dd"></nz-date-picker>
            </nz-form-control>
          </nz-form-item>
        </nz-col>
      </nz-row>
      <nz-row [nzGutter]="10">
        <nz-col [nzSpan]="12">
          <nz-form-item>
            <nz-form-label [nzSpan]="6" nzFor="contractType" nzRequired>合同类型</nz-form-label>
            <nz-form-control [nzErrorTip]="'请选择合同类型'">
              <nz-select formControlName="contractType">
                <nz-option nzLabel="全职" [nzValue]="10"></nz-option>
                <nz-option nzLabel="兼职" [nzValue]="20"></nz-option>
                <nz-option nzLabel="实习" [nzValue]="30"></nz-option>
              </nz-select>
            </nz-form-control>
          </nz-form-item>
        </nz-col>
        <nz-col [nzSpan]="12">
          <nz-form-item>
            <nz-form-label [nzSpan]="6" nzFor="effectiveDate">生效日期</nz-form-label>
            <nz-form-control >
              <nz-date-picker formControlName="effectiveDate" nzFormat="yyyy-MM-dd"></nz-date-picker>
            </nz-form-control>
          </nz-form-item>
        </nz-col>
      </nz-row>
      <nz-row [nzGutter]="10">
        <nz-col [nzSpan]="12">
          <nz-form-item>
            <nz-form-label [nzSpan]="6" nzFor="expiryDate">到期日期</nz-form-label>
            <nz-form-control >
              <nz-date-picker formControlName="expiryDate" nzFormat="yyyy-MM-dd"></nz-date-picker>
            </nz-form-control>
          </nz-form-item>
        </nz-col>
        <nz-col [nzSpan]="12">
          <nz-form-item>
            <nz-form-label [nzSpan]="6" nzFor="state" nzRequired>合同状态</nz-form-label>
            <nz-form-control [nzErrorTip]="'请选择合同状态'">
              <nz-select formControlName="state">
                <nz-option nzLabel="有效" [nzValue]="10"></nz-option>
                <nz-option nzLabel="终止" [nzValue]="20"></nz-option>
                <nz-option nzLabel="续签" [nzValue]="30"></nz-option>
              </nz-select>
            </nz-form-control>
          </nz-form-item>
        </nz-col>
      </nz-row>
      <nz-row [nzGutter]="10">
        <nz-col [nzSpan]="12">
          <nz-form-item>
            <nz-form-label [nzSpan]="6" nzFor="workLocation">工作地点</nz-form-label>
            <nz-form-control>
              <input nz-input formControlName="workLocation" placeholder="请输入工作地点" maxlength="255"/>
            </nz-form-control>
          </nz-form-item>
        </nz-col>
        <nz-col [nzSpan]="12">
          <nz-form-item>
            <nz-form-label [nzSpan]="6" nzFor="workingHours">工作时间</nz-form-label>
            <nz-form-control>
              <input nz-input formControlName="workingHours" placeholder="请输入工作时间" maxlength="255"/>
            </nz-form-control>
          </nz-form-item>
        </nz-col>
      </nz-row>
      <nz-row [nzGutter]="10">
        <nz-col [nzSpan]="22">
          <nz-form-item>
            <nz-form-label [nzSpan]="3" nzFor="jobDescription">岗位职责</nz-form-label>
            <nz-form-control [nzErrorTip]="'请选择岗位职责'">
              <textarea nz-input formControlName="jobDescription" placeholder="请输入岗位职责" maxlength="65535"></textarea>
            </nz-form-control>
          </nz-form-item>
        </nz-col>
      </nz-row>
    </form>
  </ng-container>
  <div *nzModalFooter>
    <div class="form-button-container">
      <button nz-button nzType="primary" (click)="onSave()" [nzLoading]="saveLoading">保存</button>
      <button nz-button nzType="default" (click)="onReset()" [nzLoading]="saveLoading">重置</button>
      <button nz-button nzType="default" (click)="onBack()">关闭</button>
    </div>
  </div>
</nz-modal>
<candidate-selector (candidateSelectedEvent)="handleCandidateSelectedEvent($event)"></candidate-selector>
